<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="X-UA-Compatible" content="IE=emulateIE7"/>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <link rel="stylesheet" type="text/css" href="css/style.css"/>
    <link rel="stylesheet" type="text/css" href="css/WdatePicker.css"/>
    <link rel="stylesheet" type="text/css" href="css/skin_/table.css"/>
    <link rel="stylesheet" type="text/css" href="css/jquery.grid.css"/>
    <link rel="stylesheet" type="text/css" href="../layui-v2.3.0/layui/css/layui.css"/>

    <title></title>
</head>

<body>
<div id="subjectFlow" style="display: none">
    <table class="layui-table">
        <colgroup>
            <col width="50" style="display: none">
            <col width="150">
            <col width="150">
            <col width="150">
            <col width="220">
            <col>
        </colgroup>
        <thead>
        <tr>
            <th style="display: none">开题报告id</th>
            <th>处理人</th>
            <th>处理时间</th>
            <th>处理方法</th>
            <th>备注</th>
        </tr>
        </thead>
        <tbody id="subjectFlow">
        <tr v-for="pre in preview">
            <td id="uuid" style="display: none">{{ pre.articleid }}</td>
            <td>{{ pre.dealperson }}</td>
            <td>{{ pre.dealtime }}</td>
            <td>{{ pre.dealmethod }}</td>
            <td>{{ pre.currmessage }}</td>
        </tr>
        </tbody>
    </table>
</div>
<div id="reportFlow" style="display: none">
    <table class="layui-table">
        <colgroup>
            <col width="50" style="display: none">
            <col width="150">
            <col width="150">
            <col width="150">
            <col width="220">
            <col>
        </colgroup>
        <thead>
        <tr>
            <th style="display: none">开题报告id</th>
            <th>处理人</th>
            <th>处理时间</th>
            <th>处理方法</th>
            <th>备注</th>
        </tr>
        </thead>
        <tbody id="reportFlow">
        <tr v-for="pre in preview">
            <td id="uuid" style="display: none">{{ pre.articleid }}</td>
            <td>{{ pre.dealperson }}</td>
            <td>{{ pre.dealtime }}</td>
            <td>{{ pre.dealmethod }}</td>
            <td>{{ pre.currmessage }}</td>
        </tr>
        </tbody>
    </table>
</div>
<div id="taskDetail" style="display: none">
    <table class="layui-table">
        <colgroup>
            <col width="50" style="display: none">
            <col width="150">
            <col width="150">
            <col width="150">
            <col width="220">
            <col>
        </colgroup>
        <thead>
        <tr>
            <th style="display: none">课题id</th>
            <th>处理人</th>
            <th>处理时间</th>
            <th>处理方法</th>
            <th>备注</th>
        </tr>
        </thead>
        <tbody id="taskDetail">
        <tr v-for="pre in preview">
            <td id="uuid" style="display: none">{{ pre.articleid }}</td>
            <td>{{ pre.dealperson }}</td>
            <td>{{ pre.dealtime }}</td>
            <td>{{ pre.dealmethod }}</td>
            <td>{{ pre.currmessage }}</td>
        </tr>
        </tbody>
    </table>
</div>
<div id = "container">
<div id="hd"></div>
<div id="bd">
    <div id="main">
        <fieldset class="layui-elem-field layui-field-title">
            <legend>课题申报待办</legend>

        <div class="articleTable" id="article">
            <table id="articletable" class="layui-table">
                <colgroup>
                    <col width="50">
                    <col width="150">
                    <col width="150">
                    <col width="150">
                    <col width="200">
                    <col width="150">
                    <col width="150">
                    <col>
                </colgroup>
                <thead>
                <tr>
                    <th>id</th>
                    <th>课程名称</th>
                    <th>指导老师</th>
                    <th>发起人</th>
                    <th>上传时间</th>
                    <th>课题介绍</th>
                    <th>状态</th>
                    <th>操作</th>
                </tr>
                </thead>
                <tbody id="articleGrid" class="tbody">
                <tr v-for="pre in preview" onclick="click(this)">
                    <td id="id">{{ pre.uuid }}</td>
                    <td>{{ pre.articlename }}</td>
                    <td>{{ pre.articleauth }}</td>
                    <td>{{ pre.creater}}</td>
                    <td>{{ pre.articlecreatetime }}</td>
                    <td>{{ pre.articlevalue }}</td>
                    <td>{{ pre.status }}</td>
                    <td><a onclick="detail(this)">查看</a></td>
                </tr>
                </tbody>
            </table>
            <div id="pTable" style="width: 1200px;">
                <div id="laypage">
                </div>
            </div>
        </div>
        </fieldset>


        <fieldset class="layui-elem-field layui-field-title">
            <legend>开题报告待办</legend>
            <div class="reportTable" id="report">
                <table id="reporttable" class="layui-table">
                    <colgroup>
                        <col width="50">
                        <col width="150">
                        <col width="150">
                        <col width="150">
                        <col width="200">
                        <col width="150">
                        <col width="150">
                        <col>
                    </colgroup>
                    <thead>
                    <tr>
                        <th>id</th>
                        <th>课程名称</th>
                        <th>指导老师</th>
                        <th>发起人</th>
                        <th>上传时间</th>
                        <th>状态</th>
                        <th>附件</th>
                        <th>操作</th>
                    </tr>
                    </thead>
                    <tbody id="reportGrid" class="tbody">
                    <tr v-for="pre in preview" onclick="click(this)">
                        <td id="addr" style="display:none;">{{ pre.reportaddr }}</td>
                        <td id="id">{{ pre.uuid }}</td>
                        <td>{{ pre.repname }}</td>
                        <td>{{ pre.repauth }}</td>
                        <td>{{ pre.creater}}</td>
                        <td>{{ pre.repcreatetime }}</td>
                        <td>{{ pre.status }}</td>
                        <td><a onclick="downReport(this)">查看附件</a> </td>
                        <td><a onclick="reportDetail(this)">查看</a>&nbsp;&nbsp;<a onclick="reportEdit(this)">编辑</a></td>
                    </tr>
                    </tbody>
                </table>
                <div id="pTable2" style="width: 1200px;">
                    <div id="laypage">
                    </div>
                </div>
            </div>
        </fieldset>



        <fieldset class="layui-elem-field layui-field-title">
            <legend>论文待办</legend>
            <div class="subjectTable" id="subject">
                <table id="subjecttable" class="layui-table">
                    <colgroup>
                        <col width="50">
                        <col width="150">
                        <col width="150">
                        <col width="150">
                        <col width="200">
                        <col width="150">
                        <col width="150">
                        <col>
                    </colgroup>
                    <thead>
                    <tr>
                        <th>id</th>
                        <th>课程名称</th>
                        <th>指导老师</th>
                        <th>发起人</th>
                        <th>上传时间</th>
                        <th>状态</th>
                        <th>附件</th>
                        <th>操作</th>
                    </tr>
                    </thead>
                    <tbody id="subjectGrid" class="tbody">
                    <tr v-for="pre in preview" onclick="click(this)">
                        <td id="subaddr" style="display:none;">{{ pre.subjectadd }}</td>
                        <td id="id">{{ pre.uuid }}</td>
                        <td>{{ pre.subname }}</td>
                        <td>{{ pre.subauth }}</td>
                        <td>{{ pre.creater}}</td>
                        <td>{{ pre.subcreatetime }}</td>
                        <td>{{ pre.status }}</td>
                        <td><a onclick="downSubject(this)">查看附件</a> </td>
                        <td><a onclick="subjectDetail(this)">查看</a>&nbsp;&nbsp;<a onclick="subjectEdit(this)">编辑</a></td>
                    </tr>
                    </tbody>
                </table>
                <div id="pTable3" style="width: 1200px;">
                    <div id="laypage">
                    </div>
                </div>
            </div>
        </fieldset>



        </div>
    </div>
</div>
</div>
</div>
</div>

</body>
<script type="text/javascript" src="js/jquery.js"></script>
<script type="text/javascript" src="js/global.js"></script>
<script type="text/javascript" src="js/jquery.select.js"></script>
<script type="text/javascript" src="js/core.js"></script>
<script type="text/javascript" src="js/jquery.pagination.js"></script>
<script type="text/javascript" src="js/jquery.grid.js"></script>
<script type="text/javascript" src="js/WdatePicker.js"></script>
<script type="text/javascript" src="../js/jquery.cookie.js"></script>
<script type="text/javascript" src="../js/application.js"></script>
<script type="text/javascript" src="../js/vue.js"></script>
<script type="text/javascript" src="../layui-v2.3.0/layui/layui.js"></script>
<script type="text/javascript">
//===============================================================课题待办
    var article = new Vue({
        el: '#article',
        data: {
            preview: ""
        }
    });
    layui.use('laypage', function () {
        var laypage = layui.laypage;
        var jon = {};
        jon['token'] = getCookie('token');
        $.ajax({
            url:"/getMyArticleCount",
            type:"POST",
            data:{"jon":JSON.stringify(jon)},
            success:function (res) {
                debugger;
                console.log(res);
                laypage.render({
                    elem: 'pTable'
                    , count: res
                    , limit: 5
                    , jump: function (obj, first) {
                        //obj包含了当前分页的所有参数，比如：
                        //console.log(obj.curr); //得到当前页，以便向服务端请求对应页的数据。
                        //  console.log(obj.limit); //得到每页显示的条数
                        debugger;
                        var jon={};
                        jon['curr']=obj.curr;
                        jon['limit']=obj.limit;
                        jon['token'] = getCookie('token');
                        $.ajax({
                            url: "/getMyArticle",
                            type: "POST",
                            data: {"jon": JSON.stringify(jon)},
                            success: function (res) {
                                debugger;
                                var a = res.replace(/"status":"1"/g, "\"status\":\"审核中\"");
                                var b = a.replace(/"status":"0"/g, "\"status\":\"未审核\"");
                                var c = b.replace(/"status":"2"/g, "\"status\":\"已审核\"");
                                article.preview = JSON.parse(c);
                            }
                        });
                        //首次不执行
                        if (1) {
                            //do something
                        }
                    }
                });
            },
            error:function (res) {
                layer.msg("获取数据时发生错误，请重试!!!");
                console.log(res);
            }
        });
    });
//==========================================开题报告待办
var report = new Vue({
    el: '#report',
    data: {
        preview: ""
    }
});
layui.use('laypage', function () {
    var laypage = layui.laypage;
    var jon = {};
    jon['token'] = getCookie('token');
    $.ajax({
        url:"/getMyReportCount",
        type:"POST",
        data:{"jon":JSON.stringify(jon)},
        success:function (res) {
            debugger;
            console.log(res);
            laypage.render({
                elem: 'pTable2'
                , count: res
                , limit: 5
                , jump: function (obj, first) {
                    //obj包含了当前分页的所有参数，比如：
                    //console.log(obj.curr); //得到当前页，以便向服务端请求对应页的数据。
                    //  console.log(obj.limit); //得到每页显示的条数
                    debugger;
                    var jon={};
                    jon['curr']=obj.curr;
                    jon['limit']=obj.limit;
                    jon['token'] = getCookie('token');
                    $.ajax({
                        url: "/getMyReport",
                        type: "POST",
                        data: {"jon": JSON.stringify(jon)},
                        success: function (res) {
                            debugger;
                            var a = res.replace(/"status":"0"/g, "\"status\":\"未审核\"");
                            var b = a.replace(/"status":"1"/g, "\"status\":\"审核中\"");
                            var c = b.replace(/"status":"2"/g, "\"status\":\"已审核\"");
                            report.preview = JSON.parse(c);
                        }
                    });
                    //首次不执行
                    if (1) {
                        //do something
                    }
                }
            });
        },
        error:function (res) {
            layui.use('layer', function () {
                var layer = layui.layer;
                layer.msg('获取数据失败，请重试!!!', {
                    icon: 2
                });
            });
        }
    });
});
//==================================================================
var subject = new Vue({
    el: '#subject',
    data: {
        preview: ""
    }
});
layui.use('laypage', function () {
    var laypage = layui.laypage;
    var jon = {};
    jon['token'] = getCookie('token');
    $.ajax({
        url:"/getMySubjectCount",
        type:"POST",
        data:{"jon":JSON.stringify(jon)},
        success:function (res) {
            debugger;
            console.log(res);
            laypage.render({
                elem: 'pTable3'
                , count: res
                , limit: 5
                , jump: function (obj, first) {
                    //obj包含了当前分页的所有参数，比如：
                    //console.log(obj.curr); //得到当前页，以便向服务端请求对应页的数据。
                    //  console.log(obj.limit); //得到每页显示的条数
                    debugger;
                    var jon={};
                    jon['curr']=obj.curr;
                    jon['limit']=obj.limit;
                    jon['token'] = getCookie('token');
                    $.ajax({
                        url: "/getMySubject",
                        type: "POST",
                        data: {"jon": JSON.stringify(jon)},
                        success: function (res) {
                            debugger;
                            var a = res.replace(/"status":"0"/g, "\"status\":\"未审核\"");
                            var b = a.replace(/"status":"1"/g, "\"status\":\"审核中\"");
                            var c = b.replace(/"status":"2"/g, "\"status\":\"已审核\"");
                            subject.preview = JSON.parse(c);
                        }
                    });
                    //首次不执行
                    if (1) {
                        //do something
                    }
                }
            });
        },
        error:function (res) {
            layui.use('layer', function () {
                var layer = layui.layer;
                layer.msg('获取数据失败，请重试!!!', {
                    icon: 2
                });
            });
        }
    });
});
//===================================================================

    function detail(e) {
        debugger;
        var row = e.parentNode.parentNode.rowIndex;
        var id = $("#articleGrid tr:eq(" + (row - 1) + ") td:eq(0)").html();
        //得到流程审批历史
        var taskDetail = new Vue({
            el: '#taskDetail',
            data: {
                preview: ""
            }
        });
        layui.use('laypage', function () {
            var laypage = layui.laypage;
            var jon = {};
            jon['id'] = id;
            $.ajax({
                url:"/getArticleRecordCount",
                type:"POST",
                data:{"jon":JSON.stringify(jon)},
                success:function (res) {
                    debugger;
                    console.log(res);
                    laypage.render({
                        elem: 'pTable'
                        , count: res
                        , limit: 5
                        , jump: function (obj, first) {
                            //obj包含了当前分页的所有参数，比如：
                            //console.log(obj.curr); //得到当前页，以便向服务端请求对应页的数据。
                            //  console.log(obj.limit); //得到每页显示的条数
                            debugger;
                            var jon={};
                            jon['curr']=obj.curr;
                            jon['limit']=obj.limit;
                            jon['id'] = id;
                            $.ajax({
                                url: "/getArticleRecord",
                                type: "POST",
                                data: {"jon": JSON.stringify(jon)},
                                success: function (res) {
                                    debugger;
                                    taskDetail.preview = JSON.parse(res);
                                }
                            });
                            //首次不执行
                            if (1) {
                                //do something
                            }
                        }
                    });
                },
                error:function (res) {
                    layui.use('layer', function () {
                        var layer = layui.layer;
                        layer.msg('获取数据失败，请重试!!!', {
                            icon: 2
                        });
                    });
                }
            });
        });
        layui.use('layer', function () {
            var layer = layui.layer;
            layer.open({
                type: 1,
                title: '流程历史',
                closeBtn: 2,
                area: ['800px', '400px'],
                anim: 1,
                shadeClose: true,
                content: $('#taskDetail')
            });
        });
    }

    function downReport(e) {
        debugger;
        var row = e.parentNode.parentNode.rowIndex;
        var name = $("#reportGrid tr:eq(" + (row - 1) + ") td:eq(3)").html();
        var addr = $("#reportGrid tr:eq(" + (row - 1) + ") td:eq(0)").html();
        //===============================
        var form=$("<form>");
        form.attr("style","display:none");
        form.attr("class","downReportForm");
        form.attr("target","");
        form.attr("method","post");//提交方式为post
        form.attr("action","/downloadReport");//定义action
        //=================================
        var input = $("<input>");
        input.attr("name","addr");
        input.attr("id","addrtext");
        input.attr("type","text");
        input.attr("value",addr);
        $("body").append(form);
        $(".downReportForm").append(input);
        debugger;
        form.submit();
    }

function downSubject(e) {
    debugger;
    var row = e.parentNode.parentNode.rowIndex;
    var name = $("#subjectGrid tr:eq(" + (row - 1) + ") td:eq(3)").html();
    var addr = $("#subjectGrid tr:eq(" + (row - 1) + ") td:eq(0)").html();
    //===============================
    var form=$("<form>");
    form.attr("style","display:none");
    form.attr("class","downSubjectForm");
    form.attr("target","");
    form.attr("method","post");//提交方式为post
    form.attr("action","/downloadSubject");//定义action
    //=================================
    var input = $("<input>");
    input.attr("name","addr");
    input.attr("id","addrtext");
    input.attr("type","text");
    input.attr("value",addr);
    $("body").append(form);
    $(".downSubjectForm").append(input);
    debugger;
    form.submit();
}

    function reportDetail(e) {
        debugger;
        var row = e.parentNode.parentNode.rowIndex;
        var id = $("#reportGrid tr:eq(" + (row - 1) + ") td:eq(1)").html();
        //得到流程审批历史
        var reportFlow = new Vue({
            el: '#reportFlow',
            data: {
                preview: ""
            }
        });
        var jon = {};
        jon['id'] = id;
        $.ajax({
            url: "/getReportRecord",
            type: "POST",
            data: {"jon": JSON.stringify(jon)},
            success: function (res) {
                debugger;
                reportFlow.preview = JSON.parse(res);
            }
        });

        layui.use('layer', function () {
            var layer = layui.layer;
            layer.open({
                type: 1,
                title: '流程历史',
                closeBtn: 2,
                area: ['800px', '400px'],
                anim: 1,
                shadeClose: true,
                content: $('#reportFlow')
            });
        });
    }

function subjectDetail(e) {
    debugger;
    var row = e.parentNode.parentNode.rowIndex;
    var id = $("#subjectGrid tr:eq(" + (row - 1) + ") td:eq(1)").html();
    //得到流程审批历史
    var subjectFlow = new Vue({
        el: '#subjectFlow',
        data: {
            preview: ""
        }
    });
    var jon = {};
    jon['id'] = id;
    $.ajax({
        url: "/getSubjectRecord",
        type: "POST",
        data: {"jon": JSON.stringify(jon)},
        success: function (res) {
            debugger;
            subjectFlow.preview = JSON.parse(res);
        }
    });

    layui.use('layer', function () {
        var layer = layui.layer;
        layer.open({
            type: 1,
            title: '流程历史',
            closeBtn: 2,
            area: ['800px', '400px'],
            anim: 1,
            shadeClose: true,
            content: $('#subjectFlow')
        });
    });
}

    function reportEdit(e) {
        var row = e.parentNode.parentNode.rowIndex;
        var id = $("#reportGrid tr:eq(" + (row - 1) + ") td:eq(1)").html();
        var status = $("#reportGrid tr:eq(" + (row - 1) + ") td:eq(6)").html();
        if(status == '未审核'){
            window.location.href = "editReport.html?repid="+id;
        }else if(status == '审核中'){
            layui.use('layer', function () {
            var layer = layui.layer;
            layer.msg('开题报告正在审核中，禁止修改!!!', {
                icon: 2
            });
        });
        }else if(status == '已审核'){
            layui.use('layer', function () {
                var layer = layui.layer;
                layer.msg('开题报告已审核完成，禁止修改!!!', {
                    icon: 2
                });
            });
        }
    }

function subjectEdit(e) {
    var row = e.parentNode.parentNode.rowIndex;
    var id = $("#subjectGrid tr:eq(" + (row - 1) + ") td:eq(1)").html();
    var status = $("#subjectGrid tr:eq(" + (row - 1) + ") td:eq(6)").html();
    if(status == '未审核'){
        window.location.href = "editSubject.html?subid="+id;
    }else if(status == '审核中'){
        layui.use('layer', function () {
            var layer = layui.layer;
            layer.msg('论文正在审核中，禁止修改!!!', {
                icon: 2
            });
        });
    }else if(status == '已审核'){
        layui.use('layer', function () {
            var layer = layui.layer;
            layer.msg('论文已审核完成，禁止修改!!!', {
                icon: 2
            });
        });
    }
}


</script>
</html>
